﻿using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace DaveSexton.Labs.Tests.Category1.Console
{
	[Description("Description of main experiment.")]
	public sealed class MultiExperimentsLab : BaseConsoleLab
	{
		protected override IEnumerable<IExperiment> Experiments
		{
			get
			{
				return base.Experiments.Concat(new[] { new AnonymousExperiment(() => TraceLine("Anonymous")) });
			}
		}

		public void FirstExperiment()
		{
			TraceLine(GetWord(1));
		}

		[Experiment("Number 2")]
		public void SecondExperiment()
		{
			TraceLine(GetWord(2));
		}

		[Experiment("Third Experiment")]
		[Description("This is the unreasonably long description for the third experiment.  " + 
								 "It's quite long, but provides no useful information.  Let's see how " +
								 "it wraps in the console.")]
		public void ThirdExperiment()
		{
			TraceLine(GetWord(3));
		}

		// This method should not be detected as an experiment.
		public string GetWord(int number)
		{
			switch (number)
			{
				case 1:
					return "First";
				case 2:
					return "Second";
				case 3:
					return "Third";
				default:
					return number.ToString();
			}
		}

		protected override void Main()
		{
			RunExperiments();
		}
	}
}